public class Solution165 {
    public int compareVersion(String version1, String version2) {
        String[] s1=version1.split("\\.");
        String[] s2=version2.split("\\.");
        for (int i=0;i<Math.min(s1.length,s2.length);i++){
            int i1=Integer.parseInt(s1[i]);
            int i2=Integer.parseInt(s2[i]);
            if (i1>i2){
                return 1;
            }
            if (i1<i2){
                return -1;
            }
        }
        if (s1.length>s2.length){
            for (int i=s2.length;i<s1.length;i++){
                int i1=Integer.parseInt(s1[i]);
                if (i1!=0){
                    return 1;
                }
            }
        }
        if (s1.length<s2.length){
            for (int i=s1.length;i<s2.length;i++){
                int i1=Integer.parseInt(s2[i]);
                if (i1!=0){
                    return -1;
                }
            }
        }
        return 0;
    }

    public static void main(String[] args) {
        System.out.println(new Solution165().compareVersion("0.1","1.0"));
    }
}
